
//
//  UILabel+Extesion.swift
//  微博01
//
//  Created by 牛威 on 15/12/7.
//  Copyright © 2015年 牛威. All rights reserved.
//

import UIKit


extension UILabel {

         //默认颜色和字体
    
        convenience init(title: String,
            
            fontSize: CGFloat = 14,  //字体大小
            
            color: UIColor = UIColor.darkGrayColor(),  //字体颜色
            
            screenInserts: CGFloat = 0   //缩进宽度
            
            ) {
            
            self.init()
            
            text = title
                
            textColor = color
                
            numberOfLines = 0

                
            font = UIFont.systemFontOfSize(fontSize)
                
                if screenInserts == 0 {
                
                    
                textAlignment = NSTextAlignment.Center

                
                }else {
                
                  
          preferredMaxLayoutWidth = UIScreen.mainScreen().bounds.width - 2 * screenInserts
                    
                    textAlignment = .Left
                    

                
                
        }
                
                sizeToFit()
            
    }
  
}



